using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEditor.Experimental.GraphView.GraphView;

public class UiManager : MonoBehaviour
{
    // Start is called before the first frame update
    public static UiManager instance;
    public List<Transform> parnets=new List<Transform>();
    public Transform parent;
    public Transform DesParent;
    public GameObject Top;
    public List<GameObject> players = new List<GameObject>();
    private void Awake()
    {
        instance = this;
    }
    void Start()
    {
        for (int i = 0; i < ConfigManager.Ins.passengers.Count; i++) 
        {
            GameObject item = Instantiate(Resources.Load<GameObject>("PassengerItem"), parnets[i]);
            item.GetComponent<PassengerItem>().Init(ConfigManager.Ins.passengers[i]);
        }
        for (int i = 0; i < ConfigManager.Ins.playerDatas.Count; i++)
        {
            GameObject item = Instantiate(Resources.Load<GameObject>("PlayerItem"), parent);
            item.GetComponent<PlayerItem>().Init(ConfigManager.Ins.playerDatas[i],i);
           
            players.Add(item);

            GameObject DesItem= Instantiate(Resources.Load<GameObject>("DesItem"), DesParent);
            DesItem.GetComponent<DesItem>().Init(ConfigManager.Ins.playerDatas[i]);
            DesItem.transform.GetChild(0).GetChild(1).GetComponent<HyperlinkController>().Init(i);
        }   
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
